home *** CD-ROM | disk | FTP | other *** search
/ Java for 3D & VRML Worlds / Java for 3d and VRML Worlds.iso / examples / chap06 / LightDirectOnOff.wrl < prev    next >
Text File  |  1996-10-14  |  1KB  |  39 lines

  1. #VRML V2.0 utf8
  2.  
  3. #
  4. # turn on/off the light by pressing / releaseing the mouse button.
  5. #
  6.  
  7. Transform{
  8.         children[
  9.         DEF LIGHT PointLight{
  10.                 on FALSE                # initially the light is turned off.
  11.         },
  12.         Transform{
  13.                 translation 0 1 0
  14.                 children[
  15.                         # lamp shade
  16.                         DEF LAMP_SHADE Shape{
  17.                                 geometry Cone{
  18.                                         height 2
  19.                                         bottomRadius 4
  20.                                         bottom FALSE
  21.                                 }
  22.                         }
  23.                 ]
  24.         },
  25.         # sensor to turn the light on / off
  26.         DEF LIGHT_ON_SWITCH TouchSensor{}
  27.         ]
  28. }
  29.  
  30. # dummy object to reflect the light.
  31. Transform{
  32.         translation 0 -5 0
  33.         children[
  34.                 Shape{geometry Box{size 10 0.3 10}}
  35.         ]
  36. }
  37.  
  38. ROUTE LIGHT_ON_SWITCH.isActive TO LIGHT.on
  39.